@ECHO OFF
SET PROJECTNAME=%1
SET SITEURL=%2
SET ACTION=%3

ECHO %PROJECTNAME%
ECHO %SITEURL%
ECHO %ACTION%

BREAK

ECHO.
ECHO You are deploying the Ajax Web Part solution to a specific web application and activating the Custom Search feature to a specific web application.
ECHO. 

ECHO Deactivating Feature ...
StSADM -o deactivatefeature -filename AsyncWebpart_AsyncWebPartFeature\feature.xml -url %SITEURL% -force


ECHO Uninstalling Feature...
StSADM -o uninstallfeature -filename AsyncWebpart_AsyncWebPartFeature\feature.xml -force

ECHO Retracting solution ...
STSADM -o retractsolution -name %PROJECTNAME%.wsp -url %SITEURL% -immediate

PAUSE

ECHO Deleting solution ...
STSADM -o deletesolution -name %PROJECTNAME%.wsp


if "%ACTION%" == "-D" GOTO DONE


ECHO.
ECHO Adding and deploying the solution...
ECHO.

ECHO Adding Solution ...
STSADM -o addsolution -filename "%PROJECTNAME%.wsp"

ECHO Deploying solution ...
STSADM -o deploysolution -name %PROJECTNAME%.wsp -url %SITEURL% -immediate -allowgacdeployment

ECHO PAUSE

ECHO.
ECHO Activating and installing the feature...
ECHO.

ECHO Installing Feature ...
ECHO STSADM -o installfeature -filename AsyncWebpart_AsyncWebPartFeature\feature.xml -force

ECHO Activating Feature ...
ECHO STSADM -o activatefeature -filename AsyncWebpart_AsyncWebPartFeature\feature.xml  -url %SITEURL% -force

:ALMOSTDONE
ECHO Almost Done...
:DONE
ECHO Done...